﻿@model IEnumerable<RedSand.Site.Models.ComponentsInfo>
<script type="text/javascript">
    function update_properties_success() {
        $('#save-product-info').click();
    }
    function update_properties_begin() {
        $('#loading-panel').show();
    }
</script>
<div id="product-properties">
    @if (Model != null)
    {
        using (Ajax.BeginForm("components", new AjaxOptions { OnBegin = "update_properties_begin", OnFailure = "ajax_failure", OnSuccess = "update_properties_success" }))
        {
        <div class="dialog-content">
            @foreach(var item in Model)
            {
                <div class="form-cell none-float">
                    <label style=" background: #DDD; border: 1px solid #CCCCCC; margin-bottom: 6px;">@item.Name</label>
                    @Html.Action("components", new { id = ViewBag.ProductID, parent = item.ComponentsID })
                </div>
            }
        </div>
        <div class="dialog-footer">
            <input type="submit" value="Save" id="save-product-properties" />
            <input type="button" value="Cancel" onclick="closeDialog('.dialog')" />
        </div>
        }
    }
</div>
